<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
</head>
<body>
	<button onclick="add()">ADD</button>
	<script>
		var MutationObserver = window.MutationObserver || window.WebKitMutationObserver || window.MozMutationObserver;

		var callback = function(records){
		    records.map(function(record){
		        console.log('Mutation type: '+ record.type, ', target: ', record.target.nodeName);
		    });
		};
		var mo = new MutationObserver(callback);
		var option = {
		    'childList': true, 
		    'subtree': true
		};
		mo.observe(document.body, option);
		function add() {
			for (var i = 0; i < 10; i++) {
	            var p = document.createElement('p');
	         	p.innerHTML = i;
	            document.getElementsByTagName('body')[0].appendChild(p);
	        }
		}
	
	</script>
</body>
</html>